package com.itheima.tcp;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        //1.创建客户端socket对象，与指定服务器建立链接（通信管道）
        Socket clientsocket = new Socket("192.168.1.100", 10086);
        //2.获取输出流对象
        OutputStream os = clientsocket.getOutputStream();
        PrintWriter pw = new PrintWriter(os);


        //3.写出数据
        pw.write("hello,服务器");


        //4.释放资源
        pw.close();
        clientsocket.close();
    }
}
